package BookManagement.service;

import BookManagement.dao.BorrowDao;
import BookManagement.domain.Borrow;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

@Service("borrowService")
public class BorrowServiceImpl implements BorrowService{
    @Autowired
    private BorrowDao borrowDao;
    @Override
    public Borrow searchBorrowingBook(HashMap<String,Object> map){
        return borrowDao.searchBorrowingBook(map);
    }

    @Override
    public int borrowBook(Borrow borrow){
        return borrowDao.borrowBook(borrow);
    }

    @Override
    public int backBook(HashMap<String, Object> map) {
        return borrowDao.backBook(map);
    }

    @Override
    public int renewBook(HashMap<String, Object> map) {
        return borrowDao.renewBook(map);
    }

    @Override
    public List<Borrow> searchAllBorrowingBookWithUsername(HashMap<String,Object> map) {
        return borrowDao.searchAllBorrowingBookWithUsername(map);
    }

    @Override
    public List<Borrow> searchAllBorrowingBookWithBookISBN(HashMap<String,Object> map) {
        return borrowDao.searchAllBorrowingBookWithBookISBN(map);
    }

    @Override
    public List<Borrow> searchAllBorrowingBook(HashMap<String, Object> map) {
        return borrowDao.searchAllBorrowingBook(map);
    }

    @Override
    public int getTotalBorrowing() {
        return borrowDao.getTotalBorrowing();
    }

    @Override
    public int findBorrowCountByUser(String username){
        return borrowDao.findBorrowCountByUser(username);
    }

    @Override
    public int findBorrowCountByBook(String bookISBN){
        return borrowDao.findBorrowCountByBook(bookISBN);
    }

}
